/*
 * la clase CPrincipal nos permite elegir entre el idioma ingles y español
 */

/*
 * * @author Cristina Carrillo
 * @version 1.00, 2/04/2011
 */

package vista;

import javax.swing.JOptionPane;

/**
 *
 
 */
public class CPrincipal extends javax.swing.JFrame {

    /** Creates new form CPrincipal */
    public CPrincipal() {
        initComponents();
    }

    /** Los metodos de esta clase son son los radio button que estan en la ventana
     * no tienen parametros y no devuelven valor
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jPanel1 = new javax.swing.JPanel();
        jButton1 = new javax.swing.JButton();
        rbEspañol = new javax.swing.JRadioButton();
        rbIngles = new javax.swing.JRadioButton();
        jLabel1 = new javax.swing.JLabel();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);

        jPanel1 = new vista.CPanel1("f1.jpg");

        jButton1.setFont(new java.awt.Font("Broadway", 1, 12));
        jButton1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/vista/Imagenes/061.png"))); // NOI18N
        jButton1.setText("SIGUIENTE>>");
        jButton1.setEnabled(false);
        jButton1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton1ActionPerformed(evt);
            }
        });

        rbEspañol.setFont(new java.awt.Font("Broadway", 1, 12));
        rbEspañol.setText("ESPAÑOL");
        rbEspañol.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                rbEspañolActionPerformed(evt);
            }
        });

        rbIngles.setFont(new java.awt.Font("Broadway", 1, 12));
        rbIngles.setText("INGLÉS");
        rbIngles.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                rbInglesActionPerformed(evt);
            }
        });

        jLabel1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/vista/Imagenes/126.png"))); // NOI18N

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
                .addGap(105, 105, 105)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(rbEspañol)
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addComponent(rbIngles)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 14, Short.MAX_VALUE)))
                .addGap(111, 111, 111)
                .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 78, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap())
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
                .addContainerGap(120, Short.MAX_VALUE)
                .addComponent(jButton1)
                .addGap(90, 90, 90))
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addGap(21, 21, 21)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(rbEspañol)
                    .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 73, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(rbIngles)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 82, Short.MAX_VALUE)
                .addComponent(jButton1)
                .addGap(34, 34, 34))
        );

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        );

        java.awt.Dimension screenSize = java.awt.Toolkit.getDefaultToolkit().getScreenSize();
        setBounds((screenSize.width-411)/2, (screenSize.height-338)/2, 411, 338);
    }// </editor-fold>//GEN-END:initComponents

    private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
        // TODO add your handling code here:
   if (rbEspañol.isSelected()==true) {
        CPlantas pl = new CPlantas();
          pl.setVisible(true);
   }else
        if (rbIngles.isSelected()==true) {
          CPlants pl = new CPlants();
          pl.setVisible(true);

    }//GEN-LAST:event_jButton1ActionPerformed
    }
    private void rbInglesActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_rbInglesActionPerformed
        // TODO add your handling code here:

        try {
           if(rbIngles.isSelected()){

                 jButton1.setEnabled(true);
                 rbEspañol.setSelected(false);
           }


        } catch (Exception e) {
        }
}//GEN-LAST:event_rbInglesActionPerformed

    private void rbEspañolActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_rbEspañolActionPerformed
        // TODO add your handling code here:

        try {

           if(rbEspañol.isSelected()){
               jButton1.setEnabled(true);
                 rbIngles.setSelected(false);
           }
                 



        } catch (Exception e) {
        }
}//GEN-LAST:event_rbEspañolActionPerformed

    /**
    * @param args the command line arguments
    */
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new CPrincipal().setVisible(true);
            }
        });
    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton jButton1;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JRadioButton rbEspañol;
    private javax.swing.JRadioButton rbIngles;
    // End of variables declaration//GEN-END:variables

}
